import Vue from 'vue'
import VueRouter from 'vue-router'
// eslint-disable-next-line no-unused-vars
// import Home from '../views/Home.vue'
import Login from '@/views/login'
import Layout from '@/views/Layout'
import Home from '@/views/Layout/Home'
import My from '@/views/Layout/My'
import Search from '@/views/Search'
import SearchResult from '@/views/Search/SearchResult'
import ArticleDetail from '@/views/ArticleDetail'
import UserEditor from '@/views/Layout/My/UserEditor'
import Chat from '@/views/Chat'
Vue.use(VueRouter)

const routes = [
  {
    path: '/',
    redirect: '/login'
  },
  {
    path: '/login',
    name: 'login',
    component: Login
  },
  {
    path: '/layout',
    component: Layout,
    redirect: '/layout/home',
    children: [
      {
        path: 'home',
        component: Home
      },
      {
        path: 'my',
        component: My
      }
    ]
  },
  {
    path: '/search',
    name: 'search',
    component: Search
  },
  {
    path: '/SearchResult/:kw',
    name: 'SearchResult',
    component: SearchResult
  },
  {
    path: '/ArticleDetail/:art_id',
    component: ArticleDetail
  },
  {
    path: '/my/user',
    name: 'UserEditor',
    component: UserEditor
  },
  {
    path: '/Chat',
    name: 'Chat',
    component: Chat
  }
]

const router = new VueRouter({
  routes
})

export default router
